LOWCOR page# 0001 next
2: COMMENT ⊗   VALID 00006 PAGES
3: C REC  PAGE   DESCRIPTION
4: C00001 00001
5: C00002 00002    LOWCOR 6 SEPT 67
6: C00005 00003    BEGIN PWAIT
7: C00010 00004    DEVOPR: SIXBIT /CTY/            OPERATORS CONSOLE DEVICE = CTY.
8: C00013 00005    MONTH TABLE FOR DAYTIME PRINTING
9: C00014 00006      HISTOGRAM STATISTIC GATHERING ROUTINE.
10: C00017 ENDMK
11: C⊗;
    LOWCOR page# 0002 next  prev
13: SUBTTL LOWCOR 6 SEPT 67
14: 
15: SHDACS: BLOCK 20        ;ACS STORED HERE DURING ZSHAD
16: 
17: ; BEGINNING OF PROTECTED PART OF MONITOR . . .
18: CHKBEG←←.
19: 
20: ;; ON THIS PAGE LIE SOME VERY COMMON AND USEFUL ROUTINES . . .
21: 
22: TPOPJ1: AOS     -1(P)           ;RESTORE TAC THEN SKIP RETURN
23: TPOPJ:  POP     P,TAC           ;RESTORE TAC
24:         POPJ    P,              ;AND RETURN
25: 
26: CPOPJ2: AOS     (P)             ;DOUBLE SKIP SUBROUTINE RETURN
27: CPOPJ1: AOSA    (P)             ;SKIP SUBROUTINE RETURN
28: PIONJ:  CONO    PI,PION
29: CPOPJ:  POPJ    P,
30: 
31: FMCHK:  PUSHJ   P,ZSHAD
32:         JRST    CPOPJ1          ;FM ENB OK
33:         MOVE    TAC,[440700,,[ASCIZ/TURN ON FM ENB.  THEN CONTINUE.
34: /]]
35:         JSR     DDTTYP
36:         POP     P,DDTTYP
37:         JRST    4,@DDTTYP
38: 
39: ZSHAD:  CONSO   APR,MAOFF       ;ARE WE THE PDP-10?
40:         POPJ    P,              ;NO. DO NOTHING.
41:         PUSH    P,140           ;SAVE THE UUO LOCATIONS
42:         PUSH    P,141
43:         PUSH    P,LASTPR
44:         MOVEM   17,SHDACS+17    ;SAVE THE REAL AC'S SO WE DON'T ZERO THEM
45:         MOVEI   17,SHDACS
46:         BLT     17,SHDACS+16
47:         MOVE    0,[JRST ZSHAD1]
48:         MOVEM   0,141           ;SET TO TRAP OUR ILLEGAL INSTRUCTION
49:         MOVE    17,[776000,,2000]
50:         MOVEM   17,LASTPR
51:         DATAO   APR,17
52:         MOVSI   17,USRSHD
53:         BLT     17,17
54:         JRST    1,1             ;RUN USER MODE CODE IN ACS
55: 
56: ZSHAD1: EXCH    SHDACS          ;SHDACS←0 IF NO FM ENB
57:         MOVE    17,[SHDACS+1,,1]
58:         BLT     17,17
59:         POP     P,LASTPR
60:         POP     P,141
61:         POP     P,140
62:         DATAO   LASTPR
63:         SKIPN   SHDACS
64:         AOS     (P)             ;SKIP RETURN IF FM ENB OFF
65:         POPJ    P,
66: 
67: USRSHD: -1                      ;GETS LOADED INTO ACS (STARTING AT ZERO)
68:         SETZM   -2000           ;CLEAR SHADOW ZERO
69:         BLT     17,-2000+17     ;BLT ACS INTO SHADOW MEM
70:         JRST 4,                 ;GET BACK TO EXEC MODE
71:         BLOCK USRSHD-.+17
72:         0,,-2000                ;17
    LOWCOR page# 0003 next  prev
74: BEGIN PWAIT
75: ;COMMENT ⊗
76: ;NEW, SIMPLE-MINDED PWAIT ... ALGORITHM (?) BY D.POOLE
77: ;REQUIRES SYNINI TO SETZM A (SETOM A FOR OLD PWAIT CODE)
78: ;0(TAC) > 0 => P1 WANTS/HAS IT
79: ;1(TAC) > 0 => P2 WANTS/HAS IT
80: 
81: PWAIT: PUSH P,TAC
82:         XCT @-1(P)              ;PICK UP ARG AFTER CALL
83:         JUMPN PID,P2L0
84: P1L0:   AOS (TAC)
85:         SKIPG 1(TAC)            ;SKIP IF P2 ALSO WANTS/HAS IT
86:         JRST PWAITX             ;GOTCHA
87:         SOS (TAC)               ;GIVE IT UP AND TRY AGAIN
88:         JRST P1L0
89: 
90: P2L0:   AOS 1(TAC)
91:         SKIPG (TAC)
92:         JRST PWAITX
93:         SOS 1(TAC)
94:         JRST P2L0
95: 
96: XWAIT: PUSH P,TAC
97:         XCT @-1(P)              ;PICK UP ARG AFTER CALL
98:         JUMPN PID,XWAIT1
99:         SOSL (TAC)
100:         JRST PWAITX
101: XWAITE: PUSHACS
102:         PUSHJ P,DISMES
103:         ASCIZ /ππππPDP8+-2 OVER XSYNCED.  CALL FROM /
104:         HRRZ TAC,-21(P)         ;-1 FOR PUSH P,TAC
105:         PUSHJ P,DISLOC
106:         PUSHJ P,DISCRLF
107:         PUSHJ P,DISMES
108:         ASCIZ /GET A WIZARD TO CHECK PID FOR ERROR, OR
109: ON PDP-10    TYPE POPJ 3,$X
110: ON PDP-6     PRESS CONTINUE
111: /
112:         PUSHJ P,DISFLU
113:         CONSO APR,MAOFF
114:         JRST 4,.+2
115:         PUSHJ P,DDTCAL
116:         POPACS
117:         JUMPN PID,[SETZM 1(TAC)
118:                 JRST PWAITX]
119:         SETZM (TAC)
120:         JRST PWAITX
121: 
122: XWAIT1: SOSGE 1(TAC)
123:         JRST XWAITE
124: PWAITX: POP P,TAC
125:         JRST CPOPJ1
126: ;⊗
127: 
128: COMMENT ⊗ THIS IS THE OLD PWAIT...NOT USED SINCE 12/3/73
129: ;REQUIRES SYNINI TO SETOM A (SETZM A FOR NEW CODE)
130: ;; DUAL-PROCESSOR WAIT ROUTINES . . .           JAM, 1968 (?)
131: ;;                                              JHS, APR 1972
132: ;; REFERENCES:  COMMUNICATIONS OF THE ACM, VOL. 8, NUM. 9, P 569.
133: ;;              COMMUNICATIONS OF THE ACM, VOL. 9, NUM. 5, PP 320-22.
134: ;;      THESE ROUTINES ARE A MODIFICATION OF THE TWO COMPUTER ALGORITHM
135: ;; BY KNUTH ON PAGE 322 OF THE ABOVE REFERENCE.  THE FOLLOWING CORRE-
136: ;; SPONDENCES EXIST:    0(TAC) ←→ K
137: ;;                      1(TAC) ←→ CONTROL[I]    (PROCESSOR 1)
138: ;;                      2(TAC) ←→ CONTROL[J]    (PROCESSOR 2)
139: ;;      IN ADDITION,    3(TAC) IS USED AS A DEPTH COUNTER, SINCE A 
140: ;; PROCESSOR IN ITS CRITICAL SECTION CAN BE INTERRUPTED BY  ITSELF AT A
141: ;; HIGHER LEVEL AND SUCCEED IN ENTERING A HIGHER PRIORITY CRITICAL SECTION.
142: ;;      NOTE: CARE MUST BE TAKEN ON THE STANFORD SYSTEM, WHERE P2 IS THE
143: ;; PDP-6, WHICH DOES READ-MODIFY-WRITES TO MEMORY ON SKIP INSTRUCTIONS!
144: 
145: ↑PWAIT: PUSH P,TAC
146:         XCT @-1(P)              ;PICK UP ARG AFTER CALL
147:         SKIPN P2NUM             ;P2 IS RUNNING?
148:         JRST PWAIT2             ;NO, DON'T BOTHER (BUT DO AOS SINCE XWAIT IGNORES P2NUM)
149:         JUMPN PID,P2L00
150: P1L0:   SETOM 1(TAC)
151: P1L1:   AOS NPWAITS
152:         SKIPE (TAC)
153:         JRST P1L2
154:         SKIPE 2(TAC)
155:         JRST P1L1
156: P1L2:   MOVNS 1(TAC)
157:         SKIPLE 2(TAC)
158:         JRST P1L0
159:         SETOM (TAC)
160: PWAIT2: AOS 3(TAC)              ;INCREMENT DEPTH COUNT
161: PWAITX: POP P,TAC
162:         JRST CPOPJ1
163: 
164: P2L00:  PUSH P,TAC1             ;  P2 CAN'T DO SKIP'S, SAVE AN ACCUMULATOR
165:         MOVEI TAC1,             ;AND SET IT TO 0 FOR TESTS
166: P2L0:   SETOM 2(TAC)
167: P2L1:   CAMN TAC1,(TAC)
168:         JRST P2L2
169:         CAME TAC1,1(TAC)
170:         JRST P2L1
171: P2L2:   MOVNS 2(TAC)
172:         CAMGE TAC1,1(TAC)
173:         JRST P2L0
174:         SETZM (TAC)
175:         POP P,TAC1              ;  RESTORE P2'S EXTRA ACCUMULATOR
176:         JRST PWAIT2
177: 
178: ↑XWAIT: PUSH P,TAC
179:         XCT @-1(P)              ;GET ARG
180:         SOSLE 3(TAC)            ;ARE WE BACK UP TO TOP LEVEL?
181:         JRST PWAITX             ;  NO
182:         JUMPN PID,XWAIT2        ;ARE WE P1 OR P2?
183:         SETZM (TAC)             ;  P1
184:         SETZM 1(TAC)
185:         JRST PWAITX
186: 
187: XWAIT2: SETOM (TAC)             ;  P2
188:         SETZM 2(TAC)
189:         JRST PWAITX
190: 
191:        END OF OLD PWAIT CODE
192: 
193: BEND PWAIT
    LOWCOR page# 0004 next  prev
195: DEVOPR: SIXBIT /CTY/            ;OPERATORS CONSOLE DEVICE = CTY.
196:                                 ;PUBLIC LOGICAL NAME "OPR" WILL BE THIS DEVICE
197:                                 ;ALSO UNEXPLAINED MONITOR ERROR MESSAGE WILL BE TYPED
198:                                 ;ON TTY OPR(FIRST TTY TYPED ON IF DEVOPR=0)
199: DEFINE FIGMAC!(NUM)
200: <ASCIZ ?Stanford NUM!.17/J 07-25-74?>
201: PRINTS /Did you remember to change CONFIG?
202: /
203: 
204: IFE FTDISK,<
205: CONFIG: FIGMAC (2)
206: SYSTAP: SIXBIT /DTA4/
207: >
208: IFN FTDISK,<
209: CONFIG: FIGMAC (6)
210: SYSTAP: SIXBIT /DSK/
211: >
212: 
213: 
214: ;BYTE POINTERS
215: 
216: PUUOAC: POINT   4,UUO,12                ;UUO AC FIELD
217: PIOMOD: POINT   4,IOS,35                ;MODE BITS
218: PJOBN:  POINT   6,DEVCHR(DDB),5         ;DEVICE JOB ASSIGNMENT
219: PDVBLN: POINT   PUNITP,DEVCHR(DDB),35   ; DEVICE BUFFER LENGTH
220: PUNIT:  POINT   PUNITS,DEVCHR(DDB),35-PUNITP    ;DEVICE UNIT NO.
221: PSEGN:  POINT   6,JBTSTS(J),35          ; NUMBER OF HIGH SEGMENT THIS JOB HAS
222: PDSEGN: POINT   6,(AC1),35              ; NUMBER OF SEGMENT IN JBTDTS
223: PSINF0: POINT   6,JBTSIN,35             ; HEAD OF LIST, FORWARD LINK
224: PSINFJ: POINT   6,JBTSIN(J),35          ; FORWARD LINK (J)
225: PSINFT: POINT   6,JBTSIN(TAC),35        ; FORWARD LINK (TAC)
226: PSINB0: POINT   6,JBTSIN,29             ; HEAD OF LIST, BACKWARD LINK
227: PSINBJ: POINT   6,JBTSIN(J),29          ; BACKWARD LINK (J)
228: PSINBT: POINT   6,JBTSIN(TAC),29        ; BACKWARD LINK (TAC)
229: 
230: REPEAT 0,<
231: PRUNB:  POINT   2,JB2STS(J),16          ; POINTER TO PROCESSOR RUN BITS
232: >
233: 
234: PDVTIM: POINT   6,DEVCHR(DDB),17        ;TIME IN SECONDS BEFORE DEVICE
235:                                         ;IS SAID TO BE HUNG
236: PDVCNT: POINT   6,DEVCHR(DDB),11        ;COUNTER DOWN EACH SECOND,
237:                                         ;1 TO 0 TRANSITION MEANS HUNG DEVICE
238: 
239: 
240: IFN     FTSWAP,<
241: IMGIN:  POINT   8,JBTSWP(J),35          ;POINTER TO INCORE IMAGE (1K BLOCKS)
242: IMGOUT: POINT   8,JBTSWP(J),26          ;POINTER TO OUTCORE IMAGE
243: IMGINT: POINT   8,JBTSWP(DDB),35        ;POINTER TO INCORE IMAGE
244: >
245: IFN FTLOGIN,<
246: SYSPPN:        SIXBIT /  1  1/                 ;1,1 IS SYSPPN ;JS
247: DUMPPN:        SIXBIT /  1  2/                 ;1,2 IS DUMPPP  ;JS
248: CUSPPN:        SIXBIT /  1  3/                 ;1,3 IS CUSP AREA
249: HELPPP:         SIXBIT /100100/                 ;100,100 IS HELPPP AND DEMOS ;JS
250: >
    LOWCOR page# 0005 next  prev
252: ;MONTH TABLE FOR DAYTIME PRINTING
253: 
254: MONTAB: =30B5+"JAN"
255:         =27B5+"FEB"
256:         =30B5+"MAR"
257:         =29B5+"APR"
258:         =30B5+"MAY"
259:         =29B5+"JUN"
260:         =30B5+"JUL"
261:         =30B5+"AUG"
262:         =29B5+"SEP"
263:         =30B5+"OCT"
264:         =29B5+"NOV"
265:         =30B5+"DEC"
266: MIDNIT: =60*=60*=24*JIFSEC              ;NO OF JIFFIES TILL MIDNIGHT
267: 
268: 
269: ; THE FOLLOWING IS A LIST OF THE ASCII NAMES OF THE QUEUES
270: ; SO SYSTAT CAN READ THEM
271: 
272: QNAMS:
273: DEFINE X!(A) {<ASCII /A!Q   />}
274:         QUEUES
275:         CODES
276:         PQUEUES
277:         ASCII /CMQ  /   ; DON'T FORGET COMMAND WAIT!!
    LOWCOR page# 0006 next  prev
279: ;  HISTOGRAM STATISTIC GATHERING ROUTINE.
280: ;
281: ;       CALL:   PUSHJ   P,HG
282: ;               RETURN HERE ALWAYS
283: ;
284: ;       CURRENTLY, THIS ROUTINE IS CALLED (ONLY) BY KDBINT.
285: ;       THUS, STATISTICS ARE GATHERED ON EVERY KEYSTROKE OF EVERY
286: ;MICROSWITCH KEYBOARD.
287: ;       THIS ROUTINE, ONCE EVERY HGSET TIMES IT IS CALLED, WILL
288: ;INCREMENT ONE & ONLY ONE OF THE 5 COUNTERS: HGCH6,HGUSR,HGSPW,HGUUO,
289: ;HGSYS.  IN ADDITION, IF HGSYS IS INCREMENTED, THEN ONE OF THE
290: ;COUNTERS HGCNTS WILL BE INCREMENTED, AND IF HGUSR IS INCREMENTED
291: ;AT A TIME WHEN THE NULL JOB IS RUNNING, THEN EITHER HGNULL OR HGIDLE
292: ;DEPENDING ON THE STATE OF <TQ+RUNQ>.
293: ;
294: ;       THIS ROUTINE CLOBBERS ACCUMULATOR TAC, RETURNS WITH POPJ, P.
295: ;NO OTHER ACCUMULATORS ARE USED.
296: 
297: IFN FTHG,<
298: HG:
299:         SOSE    HGYET           ;TIME TO DO OUR THING YET?
300:         POPJ    P,              ;NO.
301:         MOVE    TAC,HGSET
302:         MOVEM   TAC,HGYET       ;RESET TIMER
303:         CONSZ   PI,40           ;CH2 ACTIVE?
304:         AOS     HGCH2           ;YES. COUNT IT
305:         CONSZ   PI,1000         ;CHANNEL 6 IN PROGRESS?
306:         AOSA    HGCH6           ;YES, INCREMENT OUR COUNTER AND RETURN
307:         SKIPA   TAC,CH5         ;ELSE, GET PC WORD
308:         POPJ    P,              ;RETURN FOR CH6 ACTIVE.
309:         SKIPE   SPWUUF
310:         JRST    ISHGSP          ;CATCH SPCWAR UUO'S ALSO
311:         TLNN    TAC,USRMOD      ;WE INTERRUPTED A USER?
312:         JRST    HG4             ;NO. WE'RE IN THE SYSTEM
313:         CONSZ   PI,400          ;USER IN CHANNEL 7?
314: ISHGSP: AOSA    HGSPW           ;YES - SPACEWAR USER
315:         AOSA    HGUSR           ;NO. PLAIN USER CODE.
316:         POPJ    P,
317:         SKIPE   JOB             ;NULL JOB RUNNING?
318:         POPJ    P,              ;NO
319:         SKIPGE  JBTQ-RUNQ       ;IS THIS IDLE OR WASTED
320:         SKIPL   JBTQ-TQ
321:         AOSA    HGNULL          ;WASTED TIME (RUNQ OR TQ NOT EMPTY)
322:         AOS     HGIDLE          ;IDLE TIME.
323:         POPJ    P,
324: 
325: HG4:    CONSO   PI,400          ;CHANNEL 7 IN PROGRESS?
326:         AOSA    HGUUO           ;NO WE'RE IN A UUO.
327:         AOSA    HGSYS           ;WE INTERRUPTED CHANNEL 7.
328:         POPJ    P,
329:         HRRZ    TAC,HGCODE      ;GET IDENTIFICATION CODE
330:         CAIL    TAC,HGNMAX      ;A LEGAL CODE?
331:         MOVEI   TAC,0           ;NO, MAKE IT THE DEFAULT CODE
332:         AOS     HGCNTS(TAC)     ;INCREMENT APPROPRIATE HISTOGRAM COUNTER
333:         POPJ    P,
334: >
 EOF: LOWCOR end-of-file. cnt=5